<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/utils/rem.js"></script>
    <link rel="stylesheet" href="https://at.alicdn.com/t/c/font_2124975_ogwnuct6mbe.css">
    <link href="https://cdn.bootcdn.net/ajax/libs/Swiper/9.2.4/swiper-bundle.css" rel="stylesheet">
    <link rel="stylesheet" href="../css/page/classify.css">
</head>

<body>
    <div class="content">
        <div class="title">已选菜单</div>
        <ul class="list principal">
        </ul>

        <div class="title">可选菜单</div>
        <ul class="list additional">
        </ul>
    </div>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/Swiper/9.2.4/swiper-bundle.min.js"></script>
<script src="../js/config/index.js"></script>
<script src="../js/http/index.js"></script>
<script src="../js/serve/index.js"></script>
<script src="../js/utils/index.js"></script>
<script src="../js/pagge/classify.js"></script>
<script>
    class classify {
        constructor() {
            header("分类编辑")
            this.renderList();
        }
        renderList() {
            console.log(getItem("additional"))
            $(".principal").innerHTML=""
            $(".additional").innerHTML=""
            $(".principal").html(getItem("principal").map(v => `<li>${v.title}</li>`))
            $(".additional").html(getItem("additional").map(v => `<li>${v.title}</li>`))

            _(".principal li").tap(({ v, i }) => {
                i != 0 ? this.clickev("principal", "additional", { v, i }) : null
                setItem("principalIII",getItem("principal"))
            })
            _(".additional li").tap(({ v, i }) => {
                this.clickev("additional", "principal", { v, i })
                
            })
        }

        clickev(principal, additional, item) {
            let { v, i } = item;
            let getAdditional = getItem(additional)
            getAdditional.push(getItem(principal)[i])
            setItem(additional, getAdditional)

            setItem(principal, getItem(principal).filter(item => v.innerText != item.title))
            this.renderList()

        }
    }
    new classify()
</script>

</html>